If you do not have the remotes package, install it from CRAN like so:
Install spiro from GitHub like so:
spiro?As a kid, I loved spirographs. I still do. Software to make digital spirographs is not hard to find, but I had several reasons to make my own softward using R:
Enter the spiro package. It can do things like this:
# Cairo::Cairo(file = "spiro.png", width = 1000, height = 1000, pointsize = 12, type = "png", dpi = 300, bg = "black")
spiro(
fixed_radius = 800,
cycling_radius = 677,
pen_radius = 100,
color_groups = 10,
color_cycles = 61,
windings = 677 * 0.5,
transparency = 1,
start_angle = 0,
points_per_polygon = 50,
colors = scico::scico(n = 10, palette = "cork"),
end_at_beginning = F,
draw_fills = F,
background_color = NA
)Or this:
library(spiro)
spiro(fixed_radius = 800,
cycling_radius = 751,
pen_radius = 40,
color_groups = 4,
color_cycles = 2,
points_per_polygon = 20000,
colors = c("midnightblue","white","purple4","white"),
end_at_beginning = F,
background_color = "black")Or this:
spiro(
fixed_radius = 359,
cycling_radius = 261,
pen_radius = 40,
color_groups = 36,
color_cycles = 36,
draw_fills = F,
points_per_polygon = 200,
line_width = 3.5,
background_color = "black",
colors = c(
scales::div_gradient_pal(low = "royalblue4",
mid = "black",
high = "firebrick4")(seq(0, 1, length.out = 18)),
scales::div_gradient_pal(low = "royalblue",
mid = "white",
high = "firebrick")(seq(0, 1, length.out = 18))
)
)A spirograph is made with a pen attached to a circle that rolls around another cyrcle: